<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>test4</title>
</head>
<body>
	<script>
		var start = new Date;
		setTimeout(function(){
			var end = new Date;
			console.log("Time:",end-start,'ms');
		},500);

		while(new Date - start < 1000){

		}
	</script>
</body>
</html>